package com.quanyan.orderpay.request;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.quanyan.BaseRequest;
import com.quanyan.common.validation.enums.Money;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author songzj
 * @date 16/6/3-17:14
 */

public class ReqOrderSave extends BaseRequest {


    private static final long serialVersionUID = -5075646427451042479L;

    private String orderNo; //订单系统订单号. 业务系统不需要关注.

    @NotEmpty
    private String outTradeNo; //外部系统流水号. 业务号

    @NotNull
    private Integer uid; //用户UID

    @NotEmpty
    @Size(min = 1, max = 200)
    private String orderDescribe;  //买了什么

    @NotNull
    private Integer payTimeOut;  //订单超时时间

    @Money
    @NotNull
    private BigDecimal orderAmount; //订单金额.

    @NotEmpty
    private List<ReqProductDetail> productDetailList;  //购买的商品明细列表

    private Integer channelId = 0; //默认 0

    private String contactName; //联系人姓名

    private String contactMobile; //联系人电话

    private Integer mchId = 2; //城市ID / 与城市关联的账户ID. 固定传2.

    private String orderSubject; //订单主题

    private String payNote; //附言.

    private String notifyURL; //支付成功回调URL.  dubbo调用的方式可不传. 使用mq

    private String closeNotifyURL; //关闭订单回调URL.  dubbo调用的方式可不传. 使用mq

    private String exceptionRefundNotify; //异常支付订单退款申请回调URL.  dubbo调用的方式可不传. 使用mq

    private String payConfirmNotifyURL; //扫码支付订单成功确认回调URL.  dubbo调用的方式可不传. 使用mq

    private String refundNotifyURL; //订单退款完成回调URL.  dubbo调用的方式可不传. 使用mq
    
    private String orderURL; //订单缩略图URL

    private String showURL; //商品详情URL

    private String showURLForH5;// 商品展示网址 用户付款中途退出返回商户网站的地址。(支付宝)

    private String returnUrlForH5; //页面跳转同步通知页面路径 支付宝处理完请求后，当前页面自动跳转到商户网站里指定页面的http路径。（支付宝）

    private String extraParam; //扩展字段. 原样返回

    @NotEmpty
    private String service="service.order"; //serviceCode. 见wiki http://192.168.30.7:8090/pages/viewpage.action?pageId=7438558



    private String userClientIp; //用户端IP. 如果没有. 传服务器本机ip

    private String buyerAccount; //购买者微信OPENID 支付宝账号. app支付可不传



    private List<ReqPayInfo> payInfos; //用户选择的支付方式列表.

    private String authCode;
    //鸟蛋使用 收款方
    private String eggReceiver;

    //鸟蛋使用 备注
    private String eggInfo;

    //下单时间戳
    private Date submitDate;

    public Date getSubmitDate() {
        return submitDate;
    }

    public void setSubmitDate(Date submitDate) {
        this.submitDate = submitDate;
    }

    public String getPayConfirmNotifyURL() {
        return payConfirmNotifyURL;
    }

    public void setPayConfirmNotifyURL(String payConfirmNotifyURL) {
        this.payConfirmNotifyURL = payConfirmNotifyURL;
    }


    public String getShowURLForH5() {
        return showURLForH5;
    }

    public void setShowURLForH5(String showURLForH5) {
        this.showURLForH5 = showURLForH5;
    }

    public String getReturnUrlForH5() {
        return returnUrlForH5;
    }

    public void setReturnUrlForH5(String returnUrlForH5) {
        this.returnUrlForH5 = returnUrlForH5;
    }

    public String getAuthCode() {
        return authCode;
    }

    public void setAuthCode(String authCode) {
        this.authCode = authCode;
    }

    public String getEggReceiver() {
        return eggReceiver;
    }

    public void setEggReceiver(String eggReceiver) {
        this.eggReceiver = eggReceiver;
    }

    public String getEggInfo() {
        return eggInfo;
    }

    public void setEggInfo(String eggInfo) {
        this.eggInfo = eggInfo;
    }

    public String getRefundNotifyURL() {
        return refundNotifyURL;
    }

    public void setRefundNotifyURL(String refundNotifyURL) {
        this.refundNotifyURL = refundNotifyURL;
    }

    public String getExceptionRefundNotify() {
        return exceptionRefundNotify;
    }

    public void setExceptionRefundNotify(String exceptionRefundNotify) {
        this.exceptionRefundNotify = exceptionRefundNotify;
    }


    public String getCloseNotifyURL() {
        return closeNotifyURL;
    }

    public void setCloseNotifyURL(String closeNotifyURL) {
        this.closeNotifyURL = closeNotifyURL;
    }



    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getContactMobile() {
        return contactMobile;
    }

    public void setContactMobile(String contactMobile) {
        this.contactMobile = contactMobile;
    }

    public BigDecimal getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(BigDecimal orderAmount) {
        this.orderAmount = orderAmount;
    }

    public Integer getMchId() {
        return mchId;
    }

    public void setMchId(Integer mchId) {
        this.mchId = mchId;
    }

    public String getOrderDescribe() {
        return orderDescribe;
    }

    public void setOrderDescribe(String orderDescribe) {
        this.orderDescribe = orderDescribe;
    }

    public String getPayNote() {
        return payNote;
    }

    public void setPayNote(String payNote) {
        this.payNote = payNote;
    }

    public String getNotifyURL() {
        return notifyURL;
    }

    public void setNotifyURL(String notifyURL) {
        this.notifyURL = notifyURL;
    }

    public String getOrderURL() {
        return orderURL;
    }

    public void setOrderURL(String orderURL) {
        this.orderURL = orderURL;
    }

    public String getShowURL() {
        return showURL;
    }

    public void setShowURL(String showURL) {
        this.showURL = showURL;
    }

    public String getExtraParam() {
        return extraParam;
    }

    public void setExtraParam(String extraParam) {
        this.extraParam = extraParam;
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public Integer getPayTimeOut() {
        return payTimeOut;
    }

    public void setPayTimeOut(Integer payTimeOut) {
        this.payTimeOut = payTimeOut;
    }

    public List<ReqProductDetail> getProductDetailList() {
        return productDetailList;
    }

    public void setProductDetailList(List<ReqProductDetail> productDetailList) {
        this.productDetailList = productDetailList;
    }

    public List<ReqPayInfo> getPayInfos() {
        return payInfos;
    }

    public void setPayInfos(List<ReqPayInfo> payInfos) {
        this.payInfos = payInfos;
    }

    public String getUserClientIp() {
        return userClientIp;
    }

    public void setUserClientIp(String userClientIp) {
        this.userClientIp = userClientIp;
    }

    public String getBuyerAccount() {
        return buyerAccount;
    }

    public void setBuyerAccount(String buyerAccount) {
        this.buyerAccount = buyerAccount;
    }


    public String getOrderSubject() {
        return orderSubject;
    }

    public void setOrderSubject(String orderSubject) {
        this.orderSubject = orderSubject;
    }

    @Override
    public String toString() {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        return gson.toJson(this);
    }
}
